<?php
/**
 * Created by PhpStorm.
 * User: Huyang
* Date: 2016/9/5
* Time: 16:57
*/

namespace App\Http\Constants;

/**
 * 报错信息业务分段
 * Class BaseExceptionConstant
 * @package App\Http\Constants
 */
class CommonExceptionConstants extends BaseExceptionConstants
{

    public static function code() {
        return $code = [
            'api_no_permission'=>               ['code'=>'1', 'message'=>'没有请求接口的权限'],
            'api_sign_error'=>                  ['code'=>'2', 'message'=>'Token签名验证失败'],
            'api_token_exp'=>                   ['code'=>'3', 'message'=>'Token已过期'],
            'api_arg_error'=>                   ['code'=>'4', 'message'=>'Token参数不正确'],
            'not_available_data'=>              ['code'=>'5', 'message'=>'请求参数错误'],
            'no_find_data'=>                    ['code'=>'6', 'message'=>'数据查询失败'],
            'data_is_not_valid'=>               ['code'=>'6', 'message'=>'数据已过期'],
            'no_login'=>                        ['code'=>'7', 'message'=>'需要登录后才能访问'],
            'no_data_permission'=>              ['code'=>'8', 'message'=>'没有数据操作权限'],
            'password_error'=>                  ['code'=>'9', 'message'=>'用户名或密码错误'],
            'ban_login'=>                       ['code'=>'10', 'message'=>'限制登录'],
        ];
    }

    public static function getKey($key) {

        $top = self::getTopCode('COMMON_EXCEPTION_START_CODE');

        $base = self::code()[$key];

        $base['code'] = $top .$base['code'];

        return $base;
    }

}


